#include "SelectionMan.h"

void SelectionMan::clear()
{
	_selected.clear();

	emit changed(NULL);
}

void SelectionMan::toggle(UMLObject* obj)
{
	iterator iter = _selected.find(obj);

	if (iter != _selected.end())
	{
		_selected.erase(iter);
		obj = NULL;
	}
	else
		_selected.insert(obj);

	emit changed(obj);
}

bool SelectionMan::contains(UMLObject* obj) const
{
	return _selected.find(obj) != _selected.end();
}

bool SelectionMan::empty() const
{
	return _selected.empty();
}

SelectionMan::iterator SelectionMan::begin()
{
	return _selected.begin();
}

SelectionMan::iterator SelectionMan::end()
{
	return _selected.end();
}

